package com.example.homework.model;

public class Contact{
    private int id;
    private String firstName="";
    private String lastName="";
    private String phone;
    private boolean blocked;
    public Contact(String firstName,String lastName,String phone){
        if (firstName==null){
            firstName="";
        }
        if (lastName==null){
            lastName="";
        }
        if (phone==null||phone.isEmpty()){
            throw new IllegalArgumentException("phone cannot be empty");
        }
        this.firstName=firstName;
        this.lastName=lastName;
        this.phone=phone;
    }
    public String getName(){
        return firstName+" "+lastName;
    }

    public Contact(int id, String firstName, String lastName, String phone, boolean blocked) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.phone = phone;
        this.blocked = blocked;
    }

    public int getId() {
        return id;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public String getPhone() {
        return phone;
    }

    public boolean isBlocked() {
        return blocked;
    }

}
